﻿Imports Microsoft.Office.Tools.Ribbon

Public Class TrackChange

    Private Sub TrackChange_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load
        Dim s As Excel.Style
        Dim newItem As RibbonDropDownItem
        For Each s In Globals.ThisAddIn.Application.ActiveWorkbook.Styles
            newItem = Me.Factory.CreateRibbonDropDownItem
            newItem.Label = s.Name

            gStyles.Items.Add(newItem)

            cb_Styles.Items.Add(newItem)
        Next
        cb_Styles.Text = My.Settings.Style
        b_TrackChanges.Checked = My.Settings.ETCActive

    End Sub

    Private Sub b_TrackChanges_Click(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles b_TrackChanges.Click
        If My.Settings.ETCActive = True Then
            b_TrackChanges.Checked = False
        Else
            b_TrackChanges.Checked = True
        End If
        My.Settings.ETCActive = b_TrackChanges.Checked
        My.Settings.Save()
    End Sub

    Private Sub cb_Styles_TextChanged(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles cb_Styles.TextChanged
        My.Settings.Style = Me.cb_Styles.Text
        My.Settings.Save()
    End Sub
End Class
